Zig 0.16#36
Open
SonyCore wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Zig 0.16 Migration —
src/main.zigI/O types removed.
std.fs.File.Writerandstd.fs.File.Readerno longer exist as Zig 0.16 rewrote theentire I/O system around an
Ioevent-loop abstraction. Rather than wiring up the new async-capable API, thefix uses libc directly:
std.c.write()for stdout output andstd.c.read()for stdin input, keyed on thePOSIX file descriptor constants
std.posix.STDOUT_FILENO/std.posix.STDIN_FILENO.std.ionamespace removed.std.io.getStdOut().writer()and.reader()no longer exist; the globalinitialization in
main()was simply deleted since we now use raw fds.std.fs.cwd().openFile()removed. The filesystem API also moved under the newIoabstraction. Thelldb-fallback tty detection was rewritten using
std.posix.openat()andstd.c.close()to get a raw fd forthe ioctl call.
std.posix.getrandom()removed. Replaced withstd.c.arc4random_buf(), which is natively available onmacOS/Darwin.
std.time.sleep()andstd.time.milliTimestamp()removed. Thestd.timemodule was stripped down toconstants only. Two small helpers were added:
sleepNs()wrappingstd.c.nanosleep(), andmilliTimestamp()wrapping
std.c.gettimeofday().std.fmt.fmtIntSizeBin()removed. The human-readable byte-size formatter was dropped fromstd.fmt.The FPS status line was updated to display raw byte counts instead.